<!DOCTYPE HTML>
<html  xmlns:th="http://www.thymeleaf.org">
<head th:include="_meta :: header">
<title>添加</title>
</head>
<body>
<article class="page-container">
	<form class="form form-horizontal"  id="form-test-add" action="#" th:action="@{/admin/test/add}">
        <div class="row cl">
             <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>名字：</label>
            <div class="formControls col-xs-10 col-sm-10">
                <input type="input-text" class="input-text" name="name" placeholder="请填写名字" id="name"/>
            </div>
        </div>
        <div class="row cl">
             <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>创建时间：</label>
             <div class="formControls col-xs-10 col-sm-10">
                 <input type="input-text" class="input-text timeSpace" readonly="readonly"
                        autocomplete="off" name="createTime" placeholder="请选择创建时间"/>
             </div>
        </div>
        <div class="row cl">
             <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>更新时间：</label>
             <div class="formControls col-xs-10 col-sm-10">
                 <input type="input-text" class="input-text timeSpace" readonly="readonly"
                        autocomplete="off" name="updateTime" placeholder="请选择更新时间"/>
             </div>
        </div>
        <div class="row cl">
             <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>文本：</label>
            <div class="formControls col-xs-10 col-sm-10" >
                <script id="editor" name="text"  type="text/plain"  style="height:500px;">
                </script>
            </div>
        </div>
        <div class="row cl">
             <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>时间：</label>
             <div class="formControls col-xs-10 col-sm-10">
                 <input type="input-text" class="input-text timeSpace" readonly="readonly"
                        autocomplete="off" name="date" placeholder="请选择时间"/>
             </div>
        </div>
        <div class="row cl">
             <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>file：</label>
            <div class="formControls col-xs-10 col-sm-10">
                <input type="input-text" class="input-text" name="file" placeholder="请填写file" id="file"/>
            </div>
        </div>
	<div class="row cl">
	<div class="col-xs-4 col-sm-3 col-xs-offset-4 col-sm-offset-3">
		<input class="btn btn-primary radius" id="subbtn" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;"/>
		<input class="btn radius" id="reset" type="reset" value="&nbsp;&nbsp;重置&nbsp;&nbsp;"/>
	</div>
	</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去-->
<div th:replace="_footer :: footerjs"></div>
<div th:replace="_ueditor :: ueditor"></div>
 <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script>
 $(function(){
	$("#form-test-add").validate({
		rules:{
            name:{
                required: true,
			},
            createTime:{
                required: true,
			},
            updateTime:{
                required: true,
			},
            text:{
                required: true,
			},
            date:{
                required: true,
			},
            file:{
                required: true,
			},
		},
		onkeyup:false,
		debug: true,
		success:"valid",
		submitHandler:function(form){
				$(form).ajaxSubmit({
				type: 'POST',
				url: "/admin/test/add" ,
				success: function(data){
					if(data.code == "0"){
						layer.designMsg('添加成功!',1,function(){
							var index = parent.layer.getFrameIndex(window.name);
							parent.location.reload();
							parent.layer.close(index);
						});
					}else{
						layer.designMsg('添加失败!');
					}
				},
                error: function(){
					layer.designMsg('添加异常!',5);
				}
			});
		}
	});
});
        lay('.timeSpace').each(function(){
            laydate.render({
                elem: this
                ,trigger: 'click'
            });
        });
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>